﻿using System;

using TableTop.TestConsoleApplication.Tests;

namespace TableTop.TestConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("TableTop.NET Test Program" +
                              Environment.NewLine +
                              Environment.NewLine);

            Console.WriteLine("Testing Chracter sheet local serialization");

            try
            {
                CSLocalTest.LocalTest();
                Console.WriteLine("Test passed.");
            }
            catch(Exception exc)
            {
                String strErrorLog = String.Empty;
                strErrorLog = String.Format("An error occured during test. Error {0}" +
                                            Environment.NewLine +
                                            "Message {1}" +
                                            Environment.NewLine +
                                            "Stacktrace {2}" +
                                            Environment.NewLine,
                                            exc.GetType().Name,
                                            exc.Message,
                                            exc.StackTrace);
                Console.WriteLine(strErrorLog);
                Console.WriteLine("Test NOT passed.");
            }

            try
            {
                CSNetworkTest.NetworkTestTCP();
                Console.WriteLine("Test passed.");
            }
            catch(Exception exc)
            {
                String strErrorLog = String.Empty;
                strErrorLog = String.Format("An error occured during test. Error {0}" +
                                            Environment.NewLine +
                                            "Message {1}" +
                                            Environment.NewLine +
                                            "Stacktrace {2}" +
                                            Environment.NewLine,
                                            exc.GetType().Name,
                                            exc.Message,
                                            exc.StackTrace);
                Console.WriteLine(strErrorLog);
                Console.WriteLine("Test NOT passed.");
            }

            try
            {
                CSAddonSystemTest.Test();
                Console.WriteLine("Test passed.");
            }
            catch (Exception exc)
            {
                String strErrorLog = String.Empty;
                strErrorLog = String.Format("An error occured during test. Error {0}" +
                                            Environment.NewLine +
                                            "Message {1}" +
                                            Environment.NewLine +
                                            "Stacktrace {2}" +
                                            Environment.NewLine,
                                            exc.GetType().Name,
                                            exc.Message,
                                            exc.StackTrace);
                Console.WriteLine(strErrorLog);
                Console.WriteLine("Test NOT passed.");
            }
            Console.WriteLine(Environment.NewLine + "Press a key to end");
            Console.ReadKey(true);
        }
    }
}
